<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2017/12/22
 * Time: 15:00
 */

namespace App\Http\Traits;


use Illuminate\Http\Request;

trait CityTrait
{
    use BaseTrait;

    //用户id
    protected $id;

    //登陆者loginSession
    protected $loginSession;
    //城市code
    protected  $citycode;
    //城市上线状态
    protected  $status;
    //城市简介
    protected  $summary;
    //城市封面
    protected  $banner;
    // 分页大小
    protected $limit;
    // 城市ID
    protected $city_id;
    // 城市名称
    protected $name;
    // 城市封面图片文件
    protected $banner_file;
    // 城市标语
    protected $slogan;

    public function __construct(Request $request)
    {
        $this->loginSession = $request->input('loginSession', '');
        $this->citycode = $request->input('citycode', '');
        $this->summary = $request->input('summary', '');
        $this->banner = $request->input('banner', '');
        $this->status = $request->input('status', '');
        $this->limit = $request->input('limit', 0);
        $this->city_id = $request->input('city_id', 0);
        $this->name = $request->input('name', '');
        if (!empty($request->file('file', ''))){
            $this->banner_file = $request->file('file', '')->store('temp');
        }
        $this->slogan = $request->input('slogan', '');
    }
}